home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / Include / FWLink.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  8.2 KB  |  254 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWLink.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWLINK_H
  11. #define FWLINK_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #ifndef FWRUNTYP_H
  18. #include "FWRunTyp.h"
  19. #endif
  20.  
  21. #ifndef _ODTYPES_
  22. #include <ODTypes.h>
  23. #endif
  24.  
  25. #if FW_LIB_EXPORT_PRAGMAS
  26. #pragma lib_export on
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. class FW_CLASS_ATTR ODStorageUnit;
  34. class FW_CLASS_ATTR ODLinkSource;
  35. class FW_CLASS_ATTR ODLink;
  36. class FW_CLASS_ATTR FW_CPresentation;
  37. class FW_CLASS_ATTR FW_CPart;
  38.  
  39. //========================================================================================
  40. //    class FW_CPublishLink
  41. //========================================================================================
  42.  
  43. class FW_CLASS_ATTR FW_CPublishLink
  44. {
  45.   public:
  46.     FW_DECLARE_CLASS
  47.  
  48.     FW_CPublishLink(Environment* ev, 
  49.                     ODUpdateID updateID, 
  50.                     FW_CPresentation* presentation);
  51.     virtual ~ FW_CPublishLink();
  52.     
  53.     virtual void        Publish(Environment* ev) = 0;    
  54.     virtual void        ExternalizeLinkContent(Environment* ev, ODStorageUnit* linkSU) = 0;
  55.  
  56.     virtual void        ContentUpdated(Environment* ev, 
  57.                                        ODUpdateID updateID,
  58.                                        FW_Boolean forceUpdate = FALSE);
  59.     
  60.     virtual ODValueType    GetPublishFormat(Environment* ev);
  61.  
  62.     virtual FW_Boolean    IsOKtoUpdate(Environment* ev, FW_Boolean forceUpdate);
  63.  
  64.     virtual void        BreakLink(Environment* ev);
  65.     virtual void        RestoreLink(Environment* ev, FW_CPart* part);
  66.  
  67.     ODLinkSource*        GetODLinkSource(Environment* ev) const;
  68.     void                SetODLinkSource(Environment* ev, ODLinkSource* odLinkSource);
  69.  
  70.     FW_Boolean            IsPending(Environment* ev) const;
  71.     ODUpdateID            GetUpdateID(Environment* ev) const;
  72.     ODUpdateID            GetPendingID(Environment* ev) const;
  73.     void                SetPendingID(Environment* ev, ODUpdateID id);
  74.     
  75.     FW_Boolean            GetSelectState(Environment* ev) const;
  76.     void                SetSelectState(Environment* ev, FW_Boolean state);
  77.  
  78.   protected:
  79.     ODLinkSource*        fODLinkSource;
  80.     ODUpdateID            fUpdateID;
  81.     FW_CPresentation*    fPresentation;
  82.   private:
  83.     ODUpdateID            fPendingID;            // changeID written to link spec
  84.     FW_Boolean            fSelected;
  85. };
  86.  
  87. //========================================================================================
  88. //    FW_CPublishLink Inlines
  89. //========================================================================================
  90.  
  91. //----------------------------------------------------------------------------------------
  92. //    FW_CPublishLink::GetODLinkSource
  93. //----------------------------------------------------------------------------------------
  94. inline ODLinkSource* FW_CPublishLink::GetODLinkSource(Environment* ev) const
  95. {
  96.     return fODLinkSource;
  97. }
  98.  
  99. //----------------------------------------------------------------------------------------
  100. //    FW_CPublishLink::IsPending
  101. //----------------------------------------------------------------------------------------
  102. inline FW_Boolean FW_CPublishLink::IsPending(Environment* ev) const
  103. {
  104.     return fODLinkSource == NULL;
  105. }
  106.  
  107. //----------------------------------------------------------------------------------------
  108. //    FW_CPublishLink::GetUpdateID
  109. //----------------------------------------------------------------------------------------
  110. inline ODUpdateID FW_CPublishLink::GetUpdateID(Environment* ev) const
  111. {
  112.     return fUpdateID;
  113. }
  114.  
  115. //----------------------------------------------------------------------------------------
  116. //    FW_CPublishLink::GetPendingID
  117. //----------------------------------------------------------------------------------------
  118. inline ODUpdateID FW_CPublishLink::GetPendingID(Environment* ev) const
  119. {
  120.     return fPendingID;
  121. }
  122.  
  123. //----------------------------------------------------------------------------------------
  124. //    FW_CPublishLink::SetPendingID
  125. //----------------------------------------------------------------------------------------
  126. inline void FW_CPublishLink::SetPendingID(Environment* ev, ODUpdateID id)
  127. {
  128.     fPendingID = id;
  129. }
  130.  
  131. //----------------------------------------------------------------------------------------
  132. //    FW_CPublishLink::GetSelectState
  133. //--------------------------------------------------------------------
  134. inline FW_Boolean FW_CPublishLink::GetSelectState(Environment* ev) const
  135. {
  136.     return fSelected;
  137. }
  138.  
  139. //----------------------------------------------------------------------------------------
  140. //    FW_CPublishLink::SetSelectState
  141. //--------------------------------------------------------------------
  142. inline void FW_CPublishLink::SetSelectState(Environment* ev, FW_Boolean state)
  143. {
  144.     fSelected = state;
  145. }
  146.  
  147. //========================================================================================
  148. //    class FW_CSubscribeLink
  149. //========================================================================================
  150.  
  151. class FW_CLASS_ATTR FW_CSubscribeLink
  152. {
  153.   public:
  154.     FW_DECLARE_CLASS
  155.  
  156.     FW_CSubscribeLink(Environment* ev, 
  157.                       ODLink* odLink, 
  158.                       ODLinkInfo* linkInfo, 
  159.                       FW_CPresentation* presentation);
  160.     virtual ~FW_CSubscribeLink();
  161.     
  162.     virtual void        Subscribe(Environment* ev) = 0;
  163.  
  164.     virtual void        LinkUpdated(Environment* ev, ODUpdateID updateID);
  165.                         
  166.     virtual void        DoUpdateLink(Environment* ev, ODStorageUnit* linkContentSU) = 0;
  167.     virtual void        DoPropagateChanges(Environment* ev, ODUpdateID updateID);
  168.  
  169.     virtual void        BreakLink(Environment* ev);
  170.     virtual void        RestoreLink(Environment* ev, FW_CPart* part);
  171.  
  172.     ODLink*             GetODLink(Environment* ev) const;
  173.     FW_Boolean            IsAutoUpdate(Environment* ev) const;
  174.  
  175.     FW_Boolean            IsRegistered(Environment* ev) const;
  176.     void                Register(Environment* ev, FW_CPart* itsPart);
  177.     void                Unregister(Environment* ev);
  178.                         
  179.     FW_Boolean            GetSelectState(Environment* ev) const;
  180.     void                SetSelectState(Environment* ev, FW_Boolean state);
  181.  
  182.     ODUpdateID            GetUpdateID(Environment* ev) const;
  183.     void                HandleSubscribe(Environment* ev);
  184.  
  185.   protected:
  186.     ODLink*                fODLink;
  187.     ODLinkInfo            fLinkInfo;
  188.     FW_CPresentation*    fPresentation;
  189.   private:
  190.     FW_Boolean            fRegistered;
  191.     FW_Boolean            fSelected;
  192.     FW_CPart*            fPart;
  193.     FW_Boolean            fNeedsSubscribe;
  194. };
  195.  
  196. //========================================================================================
  197. //    FW_CSubscribeLink Inlines
  198. //========================================================================================
  199.  
  200. //----------------------------------------------------------------------------------------
  201. //    FW_CSubscribeLink::GetODLink
  202. //----------------------------------------------------------------------------------------
  203. inline ODLink* FW_CSubscribeLink::GetODLink(Environment* ev) const
  204. {
  205.     return fODLink;
  206. }
  207.  
  208. //----------------------------------------------------------------------------------------
  209. //    FW_CSubscribeLink::IsAutoUpdate
  210. //--------------------------------------------------------------------
  211. inline FW_Boolean FW_CSubscribeLink::IsAutoUpdate(Environment* ev) const
  212. {
  213.     return fLinkInfo.autoUpdate;
  214. }
  215.  
  216. //----------------------------------------------------------------------------------------
  217. //    FW_CSubscribeLink::IsRegistered
  218. //--------------------------------------------------------------------
  219. inline FW_Boolean FW_CSubscribeLink::IsRegistered(Environment* ev) const
  220. {
  221.     return fRegistered;
  222. }
  223.  
  224. //----------------------------------------------------------------------------------------
  225. //    FW_CSubscribeLink::GetSelectState
  226. //--------------------------------------------------------------------
  227. inline FW_Boolean FW_CSubscribeLink::GetSelectState(Environment* ev) const
  228. {
  229.     return fSelected;
  230. }
  231.  
  232. //----------------------------------------------------------------------------------------
  233. //    FW_CSubscribeLink::SetSelectState
  234. //--------------------------------------------------------------------
  235. inline void FW_CSubscribeLink::SetSelectState(Environment* ev, FW_Boolean state)
  236. {
  237.     fSelected = state;
  238. }
  239.  
  240. //----------------------------------------------------------------------------------------
  241. //    FW_CSubscribeLink::GetUpdateID
  242. //--------------------------------------------------------------------
  243. inline ODUpdateID FW_CSubscribeLink::GetUpdateID(Environment* ev) const
  244. {
  245.     return fLinkInfo.change;
  246. }
  247.  
  248.  
  249. #if FW_LIB_EXPORT_PRAGMAS
  250. #pragma lib_export off
  251. #endif
  252.  
  253. #endif
  254.